<template>
  <div>
    <div align="left">我的位置&gt;&gt;科技项目申报&gt;项目查询</div>
    <div id="container">
      <div id="content2">
        <table width="100%" height="41" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td width="15" height="18" align="left" valign="top">
              <div align="left"></div>
            </td>
            <td width="385" align="left" valign="bottom" class="12">&nbsp;</td>
          </tr>
          <tr>
            <td height="4" colspan="2" align="left" valign="bottom"></td>
          </tr>
          <tr>
            <td height="15" align="left" valign="top">&nbsp;</td>
            <td height="15" align="left" valign="top" class="12">
              <table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td height="20" align="center">
                    <div class="right_proaducts">
                    </div>
                    <div class=padding>
                      <div id=middlebody>
                        <table width="100%" height="50" border="0" cellpadding="0" cellspacing="1"
                               bgcolor="#f3f3f3">
                          <tbody>
                          <tr>
                            <td valign="center" align="left" width="20%">
                              <div align="right">项目内容:</div>
                            </td>
                            <td width="40%"><input size="40" v-model="projectContent" name="sercontext"/>
                            </td>
                            <td width="40%">
                              <div align="left">
                                <input type="button" @click="simpleSearch()" value="查询"/>
                                <input type="button" @click="toHighquery()" value="高级查询"/>

                              </div>
                            </td>
                          </tr>
                          </tbody>
                        </table>
                        <table :data="projectInfo" width="100%" border="0" cellpadding="0" cellspacing="1">
                          <tbody>
                          <tr>
                            <td align="center" bgcolor="#fba661">主项目</td>
                            <td align="center" bgcolor="#fba661">分项目</td>
                            <td width="208" align="center" bgcolor="#fba661">操作</td>
                          </tr>
                          <tr v-for="(p,index) in projectInfo" :key="index">
                            <td width="150" align="center" bgcolor="#f3f3f3">{{ p.categoryName }}</td>
                            <td width="342" align="center" bgcolor="#f3f3f3">
<!--                              <a :href=`../unit/viewprojectinfo1.html?pid=${p.projectId}`>{{ p.projectname }}</a>-->
                              <router-link :to="{path:'/declare/unit/viewProjectInfo1',query:{pid:p.projectId}}">{{ p.projectname }}</router-link>
                            </td>
                            <td align="center" bgcolor="#f3f3f3">
<!--                              <a :href=`../unit/viewprojectinfo.html?pid=${p.projectId}` @click="isClick(p.ispass)"
                                :style="`pointer-events:${p.ispass ==1?'none':'auto'};color:${p.ispass ==1?'gray':'blue'}`">{{ p.ispass == 1 ? "专家已评审，不能修改" : "没有评审" }}</a>-->
                              <router-link :to="{path:'/declare/unit/viewProjectInfo',query:{pid:p.projectId}}" @click.native="isClick(p.ispass)"
                                           :style="`pointer-events:${p.ispass ==1?'none':'auto'};color:${p.ispass ==1?'gray':'blue'}`">{{ p.ispass == 1 ? "专家已评审，不能修改" : "没有评审" }}</router-link>
                            </td>
                          </tr>

                          </tbody>
                        </table>
                      </div>
                    </div>
                  </td>
                </tr>
              </table>
              <br/>
              <div class="table_wz"></div>
            </td>
          </tr>
        </table>
      </div>
    </div>
    <div id="container">
      <div id="footer">
        <p><a href="http://www.ascenttech.com.cn/" target="_blank">版权所有：北京亚思晟商务科技有限公司 &copy;2004-2008|京ICP备05005681</a>
        </p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "simpleSearch",
  data() {
    return {
      projectContent:'',
      uid: JSON.parse(sessionStorage.getItem("userInfo")).uid || "",
      projectInfo:{}
    }
  },
  mounted() {
    // this.simpleSearch();
    this.returnSimpleSearchPage();
  },
  methods: {
    //注销
    logout() {
      sessionStorage.clear();
    },
    isClick(ispass){
      if(ispass == 1){
        this.$refs.viewProject.style="color:gray;cursor:pointer;pointer-events:none";
      }
    },
    //简单查询
    simpleSearch(){
      const _this = this;
      this.$axios({
        url:`http://localhost:8080/api/unit/selectProject/projectContent/pc=${_this.projectContent}`,
        method:'get',
      }).then((res)=>{
        console.log(res);
        if(res.data.code == 200){
          //将 projectContent保存起来
          sessionStorage.setItem("projectContent",this.projectContent);
          sessionStorage.setItem("projectInfo",JSON.stringify(res.data.data.projectInfo));
          _this.projectInfo = res.data.data.projectInfo;
        }
      })
    },
    toHighquery(){
      // location.href="./highquery.html"
      this.$router.push('/declare/unit/highQuery');
    },
    returnSimpleSearchPage(){
      if(sessionStorage.getItem("projectContent")){
        this.projectContent = sessionStorage.getItem("projectContent");
        this.simpleSearch();
        location.reload();
        sessionStorage.removeItem("projectContent");
      }
    }
  }
}
</script>

<style scoped>
@import "@/assets/css/unit_andreas08(blue).css";
</style>
